package org.thoughtworks.selenium.flex.ui;

import org.thoughtworks.selenium.flex.driver.SeleniumFlexDriver;
import org.thoughtworks.selenium.flex.driver.FlexDriver;

import java.lang.reflect.Constructor;
import java.util.Map;

public class UIObjectFactory {
    public static <T> T create(Class<T> clazz, Map locator, FlexDriver driver) throws Exception {
        Constructor<T> constructor = clazz.getDeclaredConstructor(DisplayObject.class, Map.class, FlexDriver.class);
        constructor.setAccessible(true);
        return constructor.newInstance(null, locator, driver);
    }
}
